home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
8bitfiles.net/archives
/
archives.tar
/
archives
/
compuserve-file-archive
/
02 Help & Utilities
/
HEX2BI.SEQ
< prev
next >
Wrap
Text File
|
2019-04-13
|
4KB
|
126 lines
10 goto370
20 rem ******************************
30 rem * hex.to.ascii *
40 rem * by tony romer [74725.1470] *
50 rem * *
60 rem * converts files captured in *
70 rem * compuserve in the form: *
80 rem * :180000000108...... *
90 rem * to true sequential/program *
100 rem * form. *
110 rem * -------------------------- *
120 rem * required if you cannot *
130 rem * capture programs in their *
140 rem * true form, but have a *
150 rem * capture buffer in your *
160 rem * terminal program. *
170 rem * will skip over unneeded *
180 rem * characters in the list. *
190 rem * also strips headers. *
200 rem ******************************
210 rem * input filename to convert *
220 rem * from, and file to convert *
230 rem * to. both files are handled *
240 rem * on disk simultaneously. *
250 rem * only requirement is that *
260 rem * disk has enough space left *
270 rem * for new file. new file *
280 rem * will be about 1/3 size of *
290 rem * input hexadecimal version. *
300 rem ******************************
310 rem * chr$(34)= "(quote) *
320 rem * chr$(144)= black *
330 rem * chr$(145)= cursor up *
340 rem * chr$(147)= home & clear *
350 rem * screen to black on yellow *
360 rem ******************************
370 poke 53280,7:poke 53281,7:print chr$(144)
380 quote$=chr$(34):header=0
390 goto440
400 rem *****************************
410 rem * read input & output *
420 rem * filenames. *
430 rem *****************************
440 print chr$(147)
450 input "file to convert from: ";infile$
460 print:input "output filename: ";outfile$
470 input"output file type (s/p) ";type$
480 print:print:open 15,8,15,"i"
490 rem ****************************
500 rem * purge prev output file!!!*
510 rem ****************************
520 rem print#15,"s0:"outfile$
530 goto580
540 rem *****************************
550 rem * input on channel 2. *
560 rem * output on channel 3. *
570 rem *****************************
580 open 2,8,2,infile$
590 if status <> 0 then1240
600 open 3,8,3,outfile$+","+type$+",w"+quote$
610 if status <> 0 thenprint:printoutfile$;" ":goto1240
620 goto670
630 rem ****************************
640 rem * scan for start of buffer *
650 rem * must be a colon. *
660 rem ****************************
670 get#2,h1$:if status <> 0 then1240
680 if h1$ <> ":" then670
690 goto740
700 rem *****************************
710 rem * set byte counter. *
720 rem * skip header. *
730 rem *****************************
740 bcount=0:rem byte counter
750 fori=1to8:get#2,h1$:next:if header then gosub1230
760 goto860
770 rem ****************************
780 rem * each byte is represented *
790 rem * by a hex pair. *
800 rem * h1$ * 16 + h2$ *
810 rem * read from file on disk *
820 rem ****************************
830 rem * end program when disk *
840 rem * read fails. *
850 rem ****************************
860 get#2,h1$
870 if status <> 0 then1240
880 goto930
890 rem ****************************
900 rem * edit hex digits. skip if *
910 rem * not a valid digit. *
920 rem ****************************
930 if h1$ < "0" or h1$ > "F" then670
940 if h1$ > "9" and h1$ < "A" then670
950 get#2,h2$
960 if status <> 0 then1240
970 if h2$ < "0" or h2$ > "F" then670
980 if h2$ > "9" and h2$ < "A" then670
990 if h1$ < "A" then h1=asc(h1$)-48
1000 if h1$ >= "A" then h1=asc(h1$)-183
1010 if h2$ < "A" then h2=asc(h2$)-48
1020 if h2$ >= "A" then h2=asc(h2$)-183
1030 byte=h1*16+h2
1040 bcount=bcount+1
1050 if bcount > 24 then670
1060 print#3,chr$(byte);
1070 if status <> 0 thenprint:printoutfile$;" ":goto1240
1080 nc=nc+1
1090 goto1160
1100 rem *****************************
1110 rem * since process is so very *
1120 rem * time consuming, let user *
1130 rem * see that process is going.*
1140 rem * (very i/o driven.) *
1150 rem *****************************
1160 print"transferred characters: ";nc:print chr$(145);
1170 goto860
1180 rem ***************************
1190 rem * skip header checksum. *
1200 rem * some programs may need *
1210 rem * this sub for 1st block. *
1220 rem ***************************
1230 for i=1to12:get#2,h1$:next:bcount=6:header=0:return
1240 input#15,a,dstatus$:close2:close3
1250 close 15:print:print dstatus$:end